#ifndef QTUI_IMPL_PROJECT_RELATED_COMMAND_ENABLER_HPP
#define QTUI_IMPL_PROJECT_RELATED_COMMAND_ENABLER_HPP

#include "QtUI/QtUIConfig.hpp"
#include <boost/signals/trackable.hpp>

class QAction;

namespace Model { class Project; }

namespace QtUI { namespace Impl
{

/// @ingroup QtUI
/// @brief It enables/disables an action based on the changed current project.
///
/// UI commands that require that the current project is valid should use this class as base class.
/// <br>
/// It binds the handler method to the project changed signal of the project controller and, by default, it disables the 
///	provided action.
class QTUI_API ProjectRelatedCommandEnabler: public boost::signals::trackable
{
public:
	/// @brief It binds the change project handler method to the project controller's signal on changed project.
	ProjectRelatedCommandEnabler( QAction* pBoundAction);

protected:
	/// @brief It enables/disables the controlled QT action based on the status of the current project (if NULL, the 
	///		action is disabled. Otherwise, it is enabled).
	void changeProject( Model::Project* newCurPrj);

private:
	QAction* pActionToCtrl_;
};


} } // namespace QtUI // namespace Impl

#endif // QTUI_IMPL_PROJECT_RELATED_COMMAND_ENABLER_HPP